define(['common','captcha'], function(common,captcha){
    var signup = {
        submit : function(selector){
            $(document).on('submit', selector, function() {
                var self = $(this);
                $.post($(this).attr('action'), $(this).serialize(), function(res, status, xhr) {
                    if(res.code==1){
                        window.location.href = res.url;
                    }else{
                        common.toastMini(res.msg);
                    }
                });
                return false;
            });
        }
    };
    captcha.get('.btn-captcha');
    captcha.image('#captcha-image>>img');
    signup.submit('form[data-toggle="signup"]');
    return signup;
});